<template>
	<div class="ordergaijia">
		<div class="gaijia-box">
			<h3 class="gaijia-title">改价</h3>
			<ul class="gaijia-yuanxinxi">
				<li>商品总价：￥<span v-text="orderxinxi.goods_amount">999.99</span></li>
				<li>运费：￥<span v-text="orderxinxi.shipping_fee">90.99</span></li>
			</ul>
			<p class="gaijia-xiaotitle">修改后</p>
			<ul class="gaijia-newxinxi">
				<li><span>商品总价：￥</span><input type="number" placeholder="请输入价格" v-model="shopzongjia"/></li>
				<li><span>现运费：￥</span><input type="number" placeholder="请输入运费价格" v-model="shopyun"/></li>
			</ul>
			<p class="gaijia-zongjia">订单总价：￥<span v-text="((Number(shopzongjia)*100+Number(shopyun)*100)/100).toFixed(2)">999.99</span></p>
			<p v-if="Number(shopzongjia)<=orderxinxi.dst_money" class="gaijia-tishi">当前订单佣金为￥<span v-text="orderxinxi.dst_money"></span>，订单金额不能低于￥<span v-text="(Number(orderxinxi.dst_money)*100+1)/100"></span></p>
			<div class="gaijia-btn">
				<span @click="gaijiasend">确定</span>
				<span @click="quxiaogai">取消</span>
			</div>
		</div>
	</div>
</template>

<script>
	export default{
		data(){
			return{
				token:0,
				orderxinxi:'',
				shopzongjia:'',
				shopyun:''
			}
		},
		props:['msg'],
		created:function(){
			var self=this;
			this.token=localStorage.getItem("nt_user");
			$.ajax({
				type:"get",
				url:furl+"index.php?app=ajax_seller_member&act=order_adjust_fee",
				data:{'token':self.token,"order_id":self.msg},
				dataType:'json',
				success:function(res){
					if(res.done){
						self.orderxinxi=res.retval;
						self.shopzongjia=res.retval.goods_amount;
						self.shopyun=res.retval.shipping_fee;
					}
				}
			});
		},
		methods:{
			gaijiasend:function(){
				var self=this;
				$.ajax({
					type:"post",
					url:furl+"index.php?app=ajax_seller_member&act=order_adjust_fee",
					data:{'token':self.token,'order_id':self.msg,'shipping_fee':self.shopyun,"goods_amount":self.shopzongjia},
					dataType:'json',
					success:function(res){
						if(res.done){
							self.$emit('gaijiasuc',true);
							alert("修改成功");
						}else{
							alert("修改失败");
						}
					}
				});
			},
			quxiaogai:function(){
				this.$emit('gaijiasuc',false);
			}
		},
		mounted:function(){
			
		}
	}
</script>

<style>
	.ordergaijia{position:fixed;z-index: 9999;background-color:rgba(0,0,0,.4);top:0;bottom:0;left:0;right:0;}
	.gaijia-box{padding:0rem 0.24rem 0.24rem;background-color:#fff;width:6rem;border-radius:0.08rem;position:absolute;top:50%;left:50%;transform: translate(-50%,-50%);}
	.gaijia-title{text-align: center;font-size:0.32rem;color:#4C9D31;line-height: 0.96rem;border-bottom: 1px solid #eee;letter-spacing: 0.3rem;padding-left: 0.3rem;}
	.gaijia-yuanxinxi{padding-top:0.3rem;padding-left: 0.5rem;}
	.gaijia-yuanxinxi>li{font-size:0.32rem;color:#2B2B2B;line-height: 0.48rem;}
	.gaijia-xiaotitle{font-size:0.24rem;color:#4C9D31;line-height: 0.48rem;padding-left: 0.5rem;font-weight: 600;}
	.gaijia-newxinxi{padding-left: 0.5rem;}
	.gaijia-newxinxi>li{font-size:0.32rem;color:#2B2B2B;line-height: 0.48rem;}
	.gaijia-newxinxi>li>input{font-size:0.32rem;color:#2B2B2B;line-height: 0.48rem;width:2.5rem;}
	.gaijia-zongjia{font-size:0.32rem;color:#2B2B2B;line-height: 0.48rem;margin-top: 0.2rem;padding-left: 0.5rem;}
	.gaijia-tishi{font-size:0.24rem;color:#4C9D31;line-height: 0.28rem;padding-left: 0.5rem;padding-right: 0.2rem;}
	.gaijia-btn{text-align: right;padding-top: 0.5rem;}
	.gaijia-btn>span:first-child{border-right:1px solid #eee;}
	.gaijia-btn>span{font-size:0.32rem;color:#2b2b2b;display: inline-block;width:1.5rem;text-align: center;line-height: 0.28rem;}
</style>